package com.arron.valueAndArgsDliver;

/**
 * @Classname Test
 * @Date 2020/8/15 18:26
 * @Created by 刘
 */
public class Test {

    public static void main(String[] args) {
        int i = 9;
        String str = "hello";
        Integer num = 9;
        int[] arry = {1, 2, 3, 4, 5};
        MyData myData = new MyData();
        change(i, str, num, arry, myData);

        //修改局部变量，不会改变，当change方法执行完毕之后就被释放，
        System.out.println("i=" + i);
        //特殊类型，改变时会产生新的对象，原值不会改变
        System.out.println("str=" + str);
        System.out.println("num=" + num);
        //改变的是属性值，会改变
        System.out.println("arry[0]=" + arry[0]);
        System.out.println("mydata.a=" + myData.a);
    }

    private static void change(int i, String str, Integer num, int[] arry, MyData myData) {

        i += 1;
        str += "word";
        num += 8;
        arry[0] = 9;
        myData.a = 10;
    }

    static class MyData {
        int a = 9;
    }






}
